<template>
  <!--日志管理-->
  <div id="base">
    <!-- 搜索 -->
    <div class="search">
      <div class="searchTop">
        <el-form :inline="true" :model="search">
          <el-form-item label="用户名">
            <el-input v-model="search.userName" placeholder="请输入用户名"></el-input>
          </el-form-item>

          <el-form-item label="操作时间">
            <el-date-picker
              v-model="search.searchTime"
              type="datetimerange"
              value-format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="getAddBook">查询</el-button>
            <el-button @click="empty" type="info">清空</el-button>
          </el-form-item>
        </el-form>
      </div>

      <!-- 按钮 -->
      <div class="searchBot">
        <!-- <el-button style="width:96px" class="buttonBot" type="primary" @click="notice">新增</el-button> -->
        <!-- icon="el-icon-plus" -->
        <!-- <el-button icon="el-icon-upload2" class="buttonBotLast" @click="excellist">导出数据</el-button> -->
      </div>
    </div>

    <!-- 列表 -->
    <div id="table">
      <el-table
        :data="this.dataa.list"
        border
        style="width: 100%"
        :header-cell-style="{ background: 'rgba(237, 242, 246, 1)' }"
      >
        <!-- <el-table-column :index="table_index" type="index" label="序号" width="50"></el-table-column> -->

        <el-table-column prop="num" type="index" label="序号" width="50"></el-table-column>
        <el-table-column prop="createTime" label="操作时间" width="200"></el-table-column>
        <el-table-column prop="userName" label="用户名"></el-table-column>
        <!-- <el-table-column prop="action" label="操作模块"></el-table-column> -->
        <el-table-column prop="result" label="操作内容"></el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <div class="pagination">
      <el-pagination
        background
        layout="prev, pager, next"
        :total="dataa.total"
        @current-change="currentpage"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      addedittitle: null,
      showedit: false,
      dialogFormVisible: false,
      // 搜索
      search: {
        action: "",
        name: "",
        page: 1,
        size: 10
      },
      // 列表数据
      dataa: {
        pagesize: "",
        list: []
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    table_index(index) {
      // return (this.data.currpage - 1) * this.data.pagesize + (index + 1);
    },
    //获取列表数据
    getList() {
      this.$http
        .post("rainLog/findList", {
          ...this.search,
          companyId: localStorage.getItem("companyId")
        })
        .then(res => {
          this.dataa = res.data;
          this.dataa.list = res.data.list;
        });
    },
    //查询
    getAddBook() {
      this.getList();
    },
    //清空
    empty() {
      (this.search = {}), this.getList();
    },
    // 翻页
    nextpage(value) {
      // this.data.currpage = value;
    },
    // 显示条数切换
    sizeChange(total) {
      this.data.pagesize = total;
    },
    currentpage(val) {
      this.search.page = val;
      this.getList();
    }
  }
};
</script>

<style lang="less" scoped>
.search {
  // overflow: hidden;
  display: flex;
  justify-content: space-between;
}
.table {
  width: 1128px;
  height: 465px;
  margin-top: 16px;
}
.table {
  width: 100%;
}
.textmsg {
  color: red;
}
.textcc {
  color: #000;
}
.paginationList {
  text-align: center;
  margin-top: 32px;
  padding: 0;
}
.table {
  width: 1128px;
  height: 465px;
  margin-top: 16px;
}
.pagination {
  text-align: center;
  margin-right: 25px;
  padding-top: 20px;
}
.green {
  color: green;
}
.red {
  color: red;
}
.texter {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
